{extend name="public:base"}
{block name='css'}
<link href="__PUBLIC__/css/plugins/iCheck/custom.css" rel="stylesheet">
{/block}

{block name='body'}
<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">

        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>提现管理</h5>
                    </div>
                    <div class="ibox-content">
						<div class="row">
							<form name="form" action="{:url('index')}" method="get">
                                <div class="col-sm-2 m-b-xs">
                                    <select name="state" class="input-sm  form-control">
                                        <option value="">审核状态</option>
                                        <option value="1" {if condition="input('state', 0, 'intval') eq 1"} selected {/if} >待审核</option>
                                        <option value="2" {if condition="input('state', 0, 'intval') eq 2"} selected {/if} >已打款</option>
                                        <option value="3" {if condition="input('state', 0, 'intval') eq 3"} selected {/if} >审核不通过</option>
                                    </select>
                                </div>
                                <div class="col-sm-3 m-b-xs">
                                    <div class="input-group">
                                        <input type="text" name="keywords" value="{:input('keywords')}" placeholder="银行/银行卡号/真实姓名" class="input-sm input-sm form-control"> <span class="input-group-btn">
                                        <button type="submit" class="btn btn-sm btn-primary"> 搜索</button> </span>
                                    </div>
                                </div>
							</form>
                        </div>
                        <table class="table table-hover">
                            <thead>
                                <th>用户编号</th>
                                <th>姓名</th>
                                <th>申请时间</th>
                                <th>提现类型</th>
                                <th>提现至</th>
                                <th>收款信息</th>
                                <th>金额</th>
                                <th>提现税收</th>
                                <th>实际金额</th>
                                <th width="80px">状态</th>
                                <th>操作</th>
                            </thead>
                            <tbody>
								{volist name="list" id="v"}
                                <tr>
                                    <td>{$v.code}</td>
                                    <td>{$v.nickname}</td>
                                    <td>{:date('Y-m-d H:i:s',$v.create_time)}</td>
                                    <td>{$v.type|get_pay_way}</td>
                                    <td>{$v.way}</td>
                                    <td>
                                        {if $v.way == '银行卡'}
                                        <?php $bank = unserialize($v['info']);?>
                                       
                                         银行卡名:{$bank.bank_name}户名：{$bank.bank_account}卡号：{$bank.bank_number}
                                        {/if}
                                        {if $v.way=='USDT'}
                                        <?php $bank = unserialize($v['info']);?>
                                        钱包地址:{$bank['usdt_url']}
                                        {/if}
                                        {if $v.way=='支付宝'}
                                        <?php $bank = unserialize($v['info']);?>
                                        <a href="{$bank.alipay_img}" target="_blank"><img src="{$bank.alipay_img}" height="50px;"/></a></a>
                                        {/if}
                                        {if $v.way=='微信'}
                                        <?php $bank = unserialize($v['info']);?>

                                        <a href="{$bank.wechat_img}" target="_blank"><img src="{$bank.wechat_img}" height="50px;"/></a></a>
                                        {/if}
                                    </td>

                                    <td>{$v.total}</td>
                                    <td>{$v.cost}</td>
                                    <td>
                                        {if $v.way == '银行卡'}
                                        {$v.amount}
                                        {else}
                                        <!-- {$v.amount/config('usdt_rate')|round=4} -->
                                        {$v.amount}
                                        {/if}
                                    </td>
                                    <td>
                                        {if $v.state == 1}
                                        待审核
                                        {elseif $v.state == 2}
                                        已完成
                                        {else}
                                        已驳回
                                        {/if}
                                    </td>
                                    <td>
                                        {eq name="v.state" value="1"}
										<a href="javascript:;" onclick="confirmPay(this, {$v.id})" class="btn btn-info btn-xs">已打款</a>
                                        <a href="javascript:;" onclick="confirmRefuse(this, {$v.id})" class="btn btn-danget btn-xs">拒绝</a>
                                        {/eq}
                                        <!-- {eq name="li.status" value="3"}
	                                    <a href="javascript:;" onclick="return del(this, {$li.id});" class="btn btn-danger btn-xs delete"><i class="fa fa-trash-o"></i> 删除</a>
                                        {/eq} -->
									</td>
                                </tr>
								{/volist}
                            </tbody>
							<tfoot>
								<tr>
                                    <td colspan="9">{$list->render()}</td>
                                </tr>
							</tfoot>
                        </table>
                    </div>
                </div>
            </div>
        </div>
        
    </div>
    
</body>
{/block}
{block name="js"}
<!--<script src="__PUBLIC__/js/plugins/peity/jquery.peity.min.js"></script>-->
<!--<script src="__PUBLIC__/js/content.min.js"></script>-->

<script type="text/javascript">
    function del(self, id){
        if ($(self).hasClass('ed')) {
            return false;
        }

        layer.confirm('真的要删除吗？删除后将无法找回！', {
            btn: ['确定','取消'] //按钮
        }, function(){
            myRequestRefresh(self, "{:url('del')}", {id:id});
        }, function(){

        });
    }

    function confirmPay(self, id){
        if ($(self).hasClass('ed')) {
            return false;
        }

        layer.confirm('确定已经打款了吗！', {
            btn: ['确定','取消'] //按钮
        }, function(){
            myRequestRefresh(self, "{:url('save')}", {id:id,state:2});
        }, function(){

        });
    }

    function confirmRefuse(self, id){
        if ($(self).hasClass('ed')) {
            return false;
        }
        layer.confirm('确定要拒绝用户的提现申请吗？', {
            btn: ['确定','取消'] //按钮
        }, function(){
            myRequestRefresh(self, "{:url('save')}", {id:id,state:3});
        }, function(){

        });
        // if (confirm("确定要拒绝用户的提现申请吗？")){
        //     // layer.prompt({title: '请输入拒绝理由，并确认', formType: 2}, function(text, index){
        //         layer.close(index);
        //         // ,reason:text
        //         btn: ['确定','取消'] //按钮
        //         myRequestRefresh(self, "{:url('save')}", {id:id,state:3});
        //     // });
        // }else{
        //     return false;
        // }
    }
</script>
{/block}
